package project.innovation.mooddiagnosis.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import project.innovation.mooddiagnosis.entity.message.MessageInfo;

import java.util.List;

public interface MessageMapper {
    @Insert("INSERT INTO message (userId, username, message, messageId, response) VALUES (#{userId},#{username},#{message},#{messageId},#{response})")
    Integer insertMessage(MessageInfo message);
    @Select("SELECT * FROM message WHERE userId = #{userId} ORDER BY messageId")
    List<MessageInfo> selectMessageOrderByMessageId(String userId);
    @Update("UPDATE message SET response = #{response} WHERE messageId = #{messageId}")
    Integer updateMessage(MessageInfo message);
}
